package StudyCode.summary.myfile;

import java.io.File;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeleteFileWhenProgramExit {

	public static void main(String[] args) {
		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
			@Override
			public void run() {
				System.out.println("程序开始退出!");
				File file = new File("E:\\Copy\\test1.txt");
				boolean delete = file.delete();
				System.out.println(file.getPath() + " 文件是否被删除? : " + delete);
			}
		}));
	}
}
